import urllib2
from bs4 import BeautifulSoup
from google.appengine.ext import db

class MyData(db.Model):
    myKey = db.StringProperty(required=True)
    myValue = db.StringProperty(required=True)

def getData():
    opener = urllib2.build_opener()
    infile = opener.open('http://police.uk/data')
    page = infile.read()
    soup = BeautifulSoup(page)
    intro = soup.find(id="intro").findNext("h3")
    return intro
    
def saveData(key,dataval):
    data = MyData(myKey=key, myValue=dataval)
    data.put()
    return
    
def getData(key):
    return db.Query(Entry).filter("myKey=",key).get().myValue
    
	

#print intro
'''
from google.appengine.ext import db
Then just store a key/value pair (you can then use this model to store any other miscellaneous strings you might add as well):

class MyData(db.Model):
    myKey = db.StringProperty(required=True)
    myValue = db.StringProperty(required=True)

data = MyData(myKey="Title", myStringValue="My App Engine Application")
data.put()
You can get it again with:

db.Query(Entry).filter("myKey=", "Title").get().myStringValue
'''
